package com.patterns.java.interpret;

/**
 * Or判断
 *
 * @author 三多
 * @Time 2021/10/13
 */
public class OrExpression implements Expression {
    private Expression exp1 = null;
    private Expression exp2 = null;

    public OrExpression(Expression exp1, Expression exp2) {
        this.exp1 = exp1;
        this.exp2 = exp2;
    }

    /**
     * Or 判断表达式
     *
     * @param context 上下文
     * @return
     */
    @Override
    public boolean interpret(String context) {
        return exp1.interpret(context) || exp2.interpret(context);
    }
}
